#include <bits/stdc++.h>
using namespace std;

#define MAXN 505

int N;

double R[MAXN], ans, cyc[MAXN];

void work() {
	for (int i = 1; i <= N; i ++) {
		scanf("%lf", &R[i]);
	}
	cyc[1] = R[1];
	ans = cyc[1] + R[1];
	for (int i = 2; i <= N; i ++) {
		double res = 0.0;
		for (int j = 1; j < i; j ++) {
			double tmp = cyc[j] + sqrt((R[i] + R[j]) * (R[i] + R[j]) - (R[i] - R[j]) * (R[i] - R[j]));
			tmp = max(tmp, R[i]);
			res = max(res, tmp);
		}
		cyc[i] = res;
		ans = max(ans, cyc[i] + R[i]);
	}
	printf("%.12lf\n", ans);
}

int main() {
	while (scanf("%d", &N) != EOF) {
		work();
	}
	return 0;
}
